package cn.jarlen.richcommon.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by jarlen on 2017/10/10.
 */

public class CropImageView extends View {

    private Drawable mDrawable = null;
    private BitmapDrawable mRecycleableBitmapDrawable = null;


    public CropImageView(Context context) {
        super(context);
    }

    public CropImageView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }


    /**
     * Sets a drawable as the content of this CropImageView.
     *
     * @param drawable the Drawable to set, or {@code null} to clear the
     *                 content
     */
    public void setImageDrawable(@Nullable Drawable drawable) {

    }


    /**
     * Sets a Bitmap as the content of this CropImageView.
     *
     * @param bm The bitmap to set
     */
    public void setImageBitmap(Bitmap bm) {
        mDrawable = null;
        if (mRecycleableBitmapDrawable == null) {
            mRecycleableBitmapDrawable = new BitmapDrawable(getResources(), bm);
        } else {
//            mRecycleableBitmapDrawable.
//            mRecycleableBitmapDrawable.setBitmap(bm);
        }

    }


}
